package service;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

import ejb.DepartmentEJBRemote;
import ejb.PositionDescriptionEJB;
import ejb.PositionDescriptionEJBRemote;
import entityJPA.Department;
import entityJPA.Positiondescription;

/**
 * Session Bean implementation class PositionService
 */
@Stateless
@LocalBean
public class DepartmentService {
	@EJB DepartmentEJBRemote dEJB;
    /**
     * Default constructor. 
     */
    public DepartmentService() {
        // TODO Auto-generated constructor stub
    }
    
    
    public Department findDepartmentById(int id){
    	List<Department> lista=dEJB.getDepartmentFindAll();
    	for(int i=0;i<lista.size();i++){
    		if(lista.get(i).getIdDepartment()==id){
    			return lista.get(i);
    		}
    	}return null;   		
    }
    
    public List<Department> getAllDepartments(){
    	List<Department> lista=dEJB.getDepartmentFindAll();
    	return lista;
    }
}

